<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div {
      width: 100px;
      height: 100px;
      background-color: #17f;
    }

    .center-horizontal {
      /* 水平居中 */
      margin: 0 auto;
    }
  </style>
</head>

<body>
  <div class="center-horizontal"></div>
</body>

</html>